package com.fc.service.impl;

import com.fc.mapper.OrderInfoDao;
import com.fc.model.SNSUserInfo;
import com.fc.model.ShareBean;
import com.fc.service.PayFlowService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


/**
 * Created by chenyan on 16/6/6.
 */
@Service("payFlow")
public class PayFlowServiceImpl implements PayFlowService {


    private static final Logger logger = LoggerFactory.getLogger(PayFlowServiceImpl.class);

    @Resource
    private OrderInfoDao orderInfoDao;


    @Override
    public void insertId(String openId, String parentId, int shareState) {
        orderInfoDao.insertId(openId,parentId,shareState);
    }

    @Override
    public void insertUserActivity(String openId, int activityId, int shareState, double redEnvelope) {
        orderInfoDao.insertUserActivity(openId,activityId,shareState,redEnvelope);
    }

    @Override
    public ShareBean selectConnectionInfo(String openId, String parentId, int activityId) {
        return orderInfoDao.selectConnectionInfo(openId,parentId,activityId);
    }

    @Override
    public void keepUserInfo(SNSUserInfo snsUserInfo) {
        orderInfoDao.keepUserInfo(
                snsUserInfo.getOpenId(),
                snsUserInfo.getNickname(),
                snsUserInfo.getSex(),
                snsUserInfo.getLanguage(),
                snsUserInfo.getCity(),
                snsUserInfo.getProvince(),
                snsUserInfo.getCountry(),
                snsUserInfo.getHeadImgUrl());
    }
    @Override
    public void updateShareState(String openId, String parentId, int activityId) {
         orderInfoDao.updateShareState(openId,parentId,activityId);
    }

    @Override
    public void updateUserActivity(String openId, int activityId, double redEnvelopt) {
        orderInfoDao.updateUserActivity(openId,activityId,redEnvelopt);
    }


    @Override
    public int isUserInfoHave(String openId) {
      return   orderInfoDao.isUserInfoHave(openId);
    }

    @Override
    public ShareBean selectUserActivity(String openId, int activityId) {
        return   orderInfoDao.selectUserActivity(openId,activityId);
    }


}
